#include <iostream>

using namespace std;

int nroCuadrados(long a, long b)
{

long int i;
int n = 0;

     i = 0;
     while( i*i < a) 
		i++;
	
     while( i*i <= b)
     {
		n++;
		i++;
     }

    return n;
}

int main() {
  long a,b;
  int n;

  
  while (1){
    n = 0;
    cin >> a >> b;
    if(b+a == 0)
	return 0;
    n = nroCuadrados(a,b);
    cout << n << endl;
  }

  return 0;
}
